import * as TYPES from '../Actions/actionTypes';

const initialState = {
	isLoggedIn: false,
	user: {}
};

let authReducer = (state=initialState, action)=>{

	switch(action.type){
		case TYPES.SIGN_IN:
			return {
				...state,
				isLoggedIn: true,
				user: action.user
			};

		case TYPES.SIGN_OUT:
			return {
				...state,
				isLoggedIn: false,
				user: {}
			};
		case TYPES.SIGN_ERRER:
			return {
				...state,
				isLoggedIn: false,
				user: {login:"errer"}
			}
		case TYPES.SIGN_WECHAT:
			return {
				...state,
				isLoggedIn: true,
				user: action.user
			}
		default: 
			return state;
	}

}


export default authReducer;

// user: {
// 	authBy:null
// 	authRemark:null
// 	authState:null
// 	authTime:null
// 	businessLicenseUrl:null
// 	company:null
// 	createdAt:null
// 	id:null
// 	identityUrl:null
// 	phone:null
// 	qq:null
// 	registerNo:null
// 	token:null
// 	truename:null
// 	updatedAt:null
// 	userId:null
// }